﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage/Main.master" AutoEventWireup="true" CodeFile="list.aspx.cs" Inherits="company_list" %>
<%@ Register Assembly="AspNetPager" Namespace="Wuqi.Webdiyer" TagPrefix="webdiyer" %>

<asp:Content ID="Content1" ContentPlaceHolderID="headcss" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" Runat="Server">
<div class="ListHead">
    <h3>Company List</h3>
</div>
<table style="width: 100%;" class="queryTable">
    <tr>
        <th style="width: 12%">Company Name</th>
        <td style="width: 20"><asp:TextBox ID="txtCompanyName" MaxLength="20" runat="server" Width="150px" CssClass="textbox"></asp:TextBox></td>
        <th style="width: 12%">Company Email：</th>
        <td style="width: 20%"><asp:TextBox ID="txtEmail" MaxLength="20" runat="server" Width="150px" CssClass="textbox"></asp:TextBox></td>
        <th style="width:12%">Company Status</th>
        <td><asp:DropDownList ID="ddpStatus" runat="server" Width="155px" CssClass="select">
                <asp:ListItem Selected="True" Value="1">New</asp:ListItem>
                <asp:ListItem Value="2">Approve</asp:ListItem>
                <asp:ListItem Value="4">Revise</asp:ListItem>
                <asp:ListItem Value="16">Reject</asp:ListItem>
            </asp:DropDownList></td>
    </tr>
    <tr>
    <td colspan="6" align="center">    
        <input id="btnAdd" class="btn" onclick="openDetail(0)" type="button" value="新增" />
        <asp:Button ID="btnSerach" CssClass="btn" class="btn" OnClick="btnSerach_Click" runat="server"  Text="查询" /></td>
    </tr>
</table>
<table cellpadding="0" cellspacing="1" border="0" class="TableList">
    <tr>
        <th>Company Name</th>
        <th>Company Email</th>
        <th>Tel</th>
        <th style="width:130px;">User Name</th>
        <th style="width:60px;">Registr Time</th>
        <th style="width:50px;">Status</th>
        <th style="width:70px;">Action</th>
    </tr>
    <%foreach (var company in CompanyList)
      { %>
    <tr>
        <td><%=company.CompanyName %></td>
        <td><%=company.CompanyEmail %></td>
        <td><%=company.CompanyPhone %></td>
        <td><%=company.UserName %></td>
        <td><%=company.viewCreateDate %></td>
        <td><%=company.viewAuditStatus %></td>
        <td><a href="javascript:" onclick="openDetail(<%=company.CompanyID %>)">Edit</a>&nbsp;&nbsp;<a href="javascript:" onclick="deleteCompany(<%=company.CompanyID %>)">Delete</a>
        <a href="javascript:" onclick="openProductDetail(<%=company.CompanyID %>)">AddProduct</a>
        <a href="javascript:" onclick="openProductList(<%=company.CompanyID %>)">ProductList</a></td>
    </tr>
    <%} %>
</table>
<table style="width: 100%;" id="tblfoot" runat="server">
    <tr>
        <td style="width: 60%;">
            <webdiyer:AspNetPager ID="AspNetPager1" OnPageChanged="AspNetPager1_PageChanged"
                runat="server" PageIndexBoxType="DropDownList" ShowPageIndexBox="Always" AlwaysShow="True">
            </webdiyer:AspNetPager>
        </td>
        <td>
            总条数：<%=AspNetPager1.RecordCount%>
        </td>
        <td>
            总页数：<%=AspNetPager1.PageCount%>
        </td>
        <td>
            每页显示：<asp:DropDownList ID="ddlPageCount" AutoPostBack="true" runat="server" OnSelectedIndexChanged="ddlPageCount_SelectedIndexChanged">
                <asp:ListItem Value="5">5</asp:ListItem>
                <asp:ListItem Value="10" Selected="True">10</asp:ListItem>
                <asp:ListItem Value="30">30</asp:ListItem>
                <asp:ListItem Value="50">50</asp:ListItem>
                <asp:ListItem Value="100">100</asp:ListItem>
            </asp:DropDownList>
        </td>
    </tr>
</table>
</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="footer" Runat="Server">
<script type="text/javascript">
function openDetail(id) {
    OpenWindow("detail.aspx?isBuy=<%=IsBuyer?1:0 %>&companyId=" + id, "1000", "800");
}
function openProductDetail(id) {
    OpenWindow("productDetail.aspx?companyId=" + id, "1000", "800");
}
function openProductList(id) {
    OpenWindow("productlist.aspx?companyId=" + id, "1000", "800");
}
function deleteCompany(id) {
    if (confirm("Are You Sure?")) {
        $.post("companyDelete.ashx", { companyId: id }, function (rValue) {
            if (rValue != "-1") {
                window.location.href = window.location.href;
            }
        });
    }
}
</script>
</asp:Content>

